package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the enquette database table.
 * 
 */
@Entity
@NamedQuery(name="Enquette.findAll", query="SELECT e FROM Enquette e")
public class Enquette implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idEnquette;

	private String dateCreation;

	private String intitule;

	//bi-directional many-to-one association to Formationannee
	@ManyToOne
	@JoinColumn(name="idFormationAnnee")
	private Formationannee formationannee;

	//bi-directional many-to-one association to Question
	@OneToMany(mappedBy="enquette")
	private List<Question> questions;

	public Enquette() {
	}

	public int getIdEnquette() {
		return this.idEnquette;
	}

	public void setIdEnquette(int idEnquette) {
		this.idEnquette = idEnquette;
	}

	public String getDateCreation() {
		return this.dateCreation;
	}

	public void setDateCreation(String dateCreation) {
		this.dateCreation = dateCreation;
	}

	public String getIntitule() {
		return this.intitule;
	}

	public void setIntitule(String intitule) {
		this.intitule = intitule;
	}

	public Formationannee getFormationannee() {
		return this.formationannee;
	}

	public void setFormationannee(Formationannee formationannee) {
		this.formationannee = formationannee;
	}

	public List<Question> getQuestions() {
		return this.questions;
	}

	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}

	public Question addQuestion(Question question) {
		getQuestions().add(question);
		question.setEnquette(this);

		return question;
	}

	public Question removeQuestion(Question question) {
		getQuestions().remove(question);
		question.setEnquette(null);

		return question;
	}

}